package com.itheima.a02jdk8datedemo;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;

public class ChronoUnitDemo1 {
    public static void main(String[] args) {
        //获取当前时间
        LocalDateTime now = LocalDateTime.now();
        System.out.println(now);
        //生日时间
        LocalDateTime birthday = LocalDateTime.of(2026,
                4, 28, 14, 25);
        System.out.println(birthday);

        System.out.println(ChronoUnit.YEARS.between(now,birthday));
        System.out.println(ChronoUnit.DAYS.between(now,birthday));
        System.out.println(ChronoUnit.HOURS.between(now,birthday));
        System.out.println(ChronoUnit.MINUTES.between(now,birthday));
        System.out.println(ChronoUnit.SECONDS.between(now,birthday));
        System.out.println(ChronoUnit.MILLIS.between(now,birthday));
        System.out.println(ChronoUnit.NANOS.between(now,birthday));
        System.out.println(ChronoUnit.MICROS.between(now,birthday));


    }
}
